package com.example.redis;

import jakarta.annotation.Resource;
import org.junit.jupiter.api.Test;
import org.redisson.api.RTopic;
import org.redisson.api.RedissonClient;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.util.DigestUtils;

@SpringBootTest
public class AppTest {

    @Resource
    private RedissonClient redissonClient;

    @Test
    public void test() {
        String str = "龙茶清欢";
        String string = DigestUtils.md5DigestAsHex(str.getBytes());
        System.out.println(string);
        // f8b395b7495969441c800ff018ebf1bf
    }

    @Test
    public void testRedis() {
        RTopic topic = redissonClient.getTopic("myTopic");
        for (int i = 0; i < 5; i++) {
            topic.publish("Hello Redisson!");
        }
    }
}
